package org.noagent;

import java.lang.instrument.ClassFileTransformer;
import java.lang.instrument.IllegalClassFormatException;
import java.security.ProtectionDomain;

public class MyClassFileTransformer implements ClassFileTransformer {
    byte[] bytes;

    @Override
    public byte[] transform(ClassLoader loader, String className, Class<?> classBeingRedefined, ProtectionDomain protectionDomain, byte[] classfileBuffer) throws IllegalClassFormatException {

        if (className.contains("AopT")) {
            System.out.println("transform " + classfileBuffer + " - " + classfileBuffer.length + " - " + className);

            if (bytes != null) {
                return bytes;
            }
        }
        return classfileBuffer;
    }
}
